﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ZyGame
{
    public abstract class Singleton<T> where T : class, new()
    {
        // private static Lazy<T> _instance = new Lazy<T>(Instantiate);
        private static T _instance;

        private static T Instantiate()
        {
            return new T();
        }

        public static T instance
        {
            get
            {
                if (_instance is null)
                {
                    _instance = new T();
                }

                return _instance;
            }
        }
    }
}